package com.xwm93up.redismq.consumer;

import com.alibaba.fastjson.JSONObject;
import com.xwm93up.redismq.pojo.UserDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @Description: desc
 * @Author: xwm93up
 * @Since: 2023/9/12 15:55
 */
@Slf4j
@Service
public class ConsumeService {
    public void processMessage(String channel, String message) {
        // 可以根据channel再继续映射到不同的实现
        UserDto userDto = JSONObject.parseObject(message, UserDto.class);
        log.info("接收的结果：{}", userDto);
        // 做业务...
        // 还可以分布式锁幂等处理
    }
}
